package com.ymall.controller.portal;

import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.ymall.common.ServerResponse;
import com.ymall.pojo.ClockRecord;
import com.ymall.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/clock/")
public class ClockController {

    @Autowired
    private ClockService clockService;

    @RequestMapping(value = "clockin.do",method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse<String> clockIn(ClockRecord clockRecord){
        return clockService.clockIn(clockRecord);
    }
    @RequestMapping(value = "getClockRecords.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse<PageList<ClockRecord>> getClockRecords (String userId){
        return clockService.selectRecordByUserId(userId);
    }
}
